package pub.guoxin.oops.repository;

import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.stereotype.Repository;
import pub.guoxin.oops.enums.Authority;
import pub.guoxin.oops.model.User;

import java.util.List;

/**
 * Created by guoxin on 17-8-12.
 */
@Repository
public interface UserRepository extends MongoRepository<User, String>, QueryDslPredicateExecutor<User> {

    User findByUsername(String username);

    User findByMobile(String mobile);

    List<User> findByCompanyIdAndAuthoritiesIsContaining(String companyId, Authority authorityEnum);
}